<template>
	<view class="content" :style="{backgroundImage: 'url('+pic+')'}">
		<view class="buttons"  v-if="show" @click="btnFn" :style="background ? background : ''">
			立即参与
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pic:'',
				background:'',
				show:false,
				buttonName:'',
				bottomPopup:{					  
				},
				shows:1,
				appId:'',
				path:'',
			}
		},
		onLoad(options) {
			const data = JSON.parse(decodeURIComponent(options.query))
			console.log(data,'options');
	     	this.appId = data.appid;
			this.path = data.path;
			
		},
		onShow(){
			
		this.getList();	
		},
		methods: {
			getList(){
				this.$u.api.getactive({
				}).then(res => {
					if (res.return_code == '200') {
			
						this.list = res.data.list;
						 this.pic = res.data.pic;
						this.background = res.data.color;
						this.show = res.data.halfsiza_applet.open == 1;
						this.buttonName = res.data.halfsiza_applet.halfsize_name;
						this.bottomPopup = res.data.halfsiza_applet;
						uni.setNavigationBarTitle({
								title: res.data.top_title
							});	
					};
				
				}).catch(err => {})
			},
			// 0不跳转 1本地 2 H5  3跳转小程序
			btnFn(){
				uni.navigateToMiniProgram({
					appId: this.appId,
					path: this.path,
					extraData: {
						'data1': 'test'
					},
					success(res) {
					
					}
				})
				let that = this;
				that.$u.api.getAward({type:23}).then(re => {
				
				}).catch(() => {});
				if (that.bottomPopup.type == 0) {
					that.bottomPopupShow = false;
				} else if (that.bottomPopup.type == 1) {
					uni.navigateTo({
						url: that.bottomPopup.self_url,
					});
				} else if (that.bottomPopup.type == 2) {
					this.$utils.jumpWebview(that.bottomPopup.url);
					/* uni.navigateTo({
						url: "/pages/webview/index?url=" + that.bottomPopup.url
					}) */
				} else if (that.bottomPopup.type == 3) {
					uni.navigateToMiniProgram({
						appId: that.bottomPopup.car_shop_appid,
						path: that.bottomPopup.url_platform,
						extraData: {
							'data1': 'test'
						},
						success(res) {
							that.$u.api.getChargings({appid: that.bottomPopup.car_shop_appid,
						appPath: that.bottomPopup.url_platform,}).then(res => {
							});			
							
							// 打开成功
						}
					})
				}
			}
		
		}
	}
</script>
<style>   
      page{height:100%;background:#000} 
</style>
<style scoped>
	.content{
		position: relative;
		overflow: hidden;
		width: 750rpx;
		height: 1490rpx;
		background-size: 100% 100%;
	}
	.buttons {
		position: absolute;
		top: 1333rpx;
		left: 62rpx;
		width: 633rpx;
		height: 90rpx;
		/* background: linear-gradient(0deg, #F54649 20%, #FF9579 100%); */
		box-shadow: 0rpx 0rpx 54rpx 0rpx rgba(255,160,62,0.6);
		border-radius: 45rpx;
		text-align: center;
		line-height: 90rpx;
		font-size: 40rpx;
		font-weight: 500;
		color: #FFFFFF;
	}
</style>
